<?php
namespace BP\Sys;

use BP\En\EntitiesMyPK;

class MapAttrs extends EntitiesMyPK {
	public static function constructor__ () 
	{
		$me = new self();
		return $me;
	}
	public static function constructor__String ($fk_map) // [String fk_map]
	{
		$me = new self();
		$qo = new QueryObject($me);
		$qo->AddWhere(MapAttrAttr::$FK_MapData, $fk_map);
		$qo->addOrderBy(MapAttrAttr::$GroupID, MapAttrAttr::$Idx);
		$qo->DoQuery();
		return $me;
	}
	public function SearchMapAttrsYesVisable ($fk_map) // [String fk_map]
	{
		$qo = new QueryObject($this);
		$qo->AddWhere(MapAttrAttr::$FK_MapData, $fk_map);
		$qo->addAnd();
		$qo->AddWhere(MapAttrAttr::$UIVisible, 1);
		$qo->addOrderBy(MapAttrAttr::$GroupID, MapAttrAttr::$Idx);
		return $qo->DoQuery();
	}
	public function getNewEntity () 
	{
		return MapAttr::constructor__();
	}
	public function getWithOfCtl () 
	{
		$i = 0;
		foreach ($this->ToJavaList() as $item) 		{
			if (($item->getUIVisible() ==  FALSE ))
			{
				continue;
			}
			$i += $item->getUIWidthInt();
		}
		return $i;
	}
	public function ToJavaList () 
	{
		return $this;
	}
	public function Tolist () 
	{
		$list = [];// 
		for ($i = 0; ($i < $this->size()); ++$i) 
		{
			$list->add($this->get($i));
		}
		return $list;
	}
}
?>
